﻿        ///// <summary>
        ///// </summary>
        //public GamingEvent Play(string host, string game, string symbol, string volume)
        //{
        //    /// --
        //    decimal _volume;

        //    /// -- perform validation of parameters
        //    if (!decimal.TryParse(volume, out _volume))
        //    { }


        //    /// -- 
        //    GamingEvent _response = new GamingEvent()
        //    {
        //        Id = Guid.NewGuid().ToString(),
        //        Host = host,
        //        Game = game
        //    };

        //    /// -- 
        //    Database _db = DatabaseFactory.CreateDatabase();
        //    using (DbConnection _dbConn = _db.CreateConnection())
        //    {
        //        /// -- open database connection
        //        _dbConn.Open();
                
        //        #region deposit for progressive jackpot
        //        decimal _depositReference;
        //        /// --
        //        try
        //        {
        //            /// -- place gaming stake into database table
        //            using (DbCommand _dbComm = _db.GetStoredProcCommand("sp_JackpotDeposit"))
        //            {
        //                _db.AddInParameter(_dbComm, "host", DbType.String , host );
        //                _db.AddInParameter(_dbComm, "game", DbType.String , game );

        //                _db.AddInParameter(_dbComm, "symbol", DbType.String , symbol);
        //                _db.AddInParameter(_dbComm, "volume", DbType.Decimal, _volume );

        //                /// --                        
        //                _depositReference = (decimal)_db.ExecuteScalar(_dbComm);                        
        //            }

        //            #region playout progressive jackpot
        //            using (DbCommand _dbComm = _db.GetStoredProcCommand("sp_JackpotPlay"))
        //            {
        //                #region StoredProcedure Parameters
        //                #region Input
        //                _db.AddInParameter(_dbComm, "@JACKPOT_DEPOSIT_ID", DbType.Decimal, _depositReference);
        //                #endregion
        //                #region Output
        //                #endregion
        //                #endregion

        //                /// -- map the return for the stored procedure into a JackpotPlay
        //                /// -- entity, which holds the details about the progressive jackpot
        //                /// -- odds and weather the progressive jackpot group is exclusive etc.
        //                IRowMapper<JackpotPlay> rowMapper = MapBuilder<JackpotPlay>
        //                    .MapAllProperties()
        //                    .Map(b => b.Id).ToColumn("PK_JACKPOT_ID")
        //                    .Map(b => b.Name).ToColumn("NAME") 
        //                    .Map(b => b.Lower).ToColumn("RNG_LOWER")
        //                    .Map(b => b.Upper).ToColumn("RNG_UPPER")
        //                    .Map(b => b.IsExclusive).ToColumn("IS_EXCLUSIVE")
        //                    .Build();

        //                /// -- the stored procedure should return a list of progressive jackpots
        //                /// -- that can be played out for a given DepositReference; the list may
        //                /// -- be empty if a DepositRefernce can't play a progressive; the stored 
        //                /// -- procedure will throw an exception if the DepositReference is not
        //                /// -- found in the database
        //                IEnumerable<JackpotPlay> _jackpotPlays = _db.ExecuteSprocAccessor<JackpotPlay>("sp_JackpotPlay", rowMapper, _depositReference);
        //                using (DbTransaction _dbTrans = _dbConn.BeginTransaction())
        //                {
        //                    /// --
        //                    using (RandomNumberServiceClient srv = new RandomNumberServiceClient())
        //                    {
        //                        /// --
        //                        foreach (JackpotPlay _jackpotPlay in _jackpotPlays)
        //                        {

        //                            /// -- if exclusive then call the random number generator and determine
        //                            /// -- if the number returned hits a range for any jackpot in the jackpot
        //                            /// -- group?
        //                            if (_jackpotPlay.IsExclusive)
        //                            {
        //                                /// -- call random number generator for each jackpot group
        //                                /// -- that is returned from the stored procedure sp_JackpotPlay
        //                                rng.model.RandomNumberSet[] _primary =  srv.Generate(host, game, _jackpotPlay.Lower, _jackpotPlay.Upper, 1, false, 1);


        //                            }
        //                            else /// -- otherwise
        //                            {
        //                                /// -- if not exclusive then call the random number generator for each
        //                                /// -- jackpot in the current jackpot group, request two numbers between
        //                                /// -- n:x (where n:x is the odds expressed as 1 in 100, 3 in 300,000 )
        //                                /// -- and therefore n number of random numbers to generate between 1 and x
        //                                /// -- and if any of these match the second single number between 1 and x
        //                                /// -- we have a winner!!
        //                                rng.model.RandomNumberSet[] _primary  = srv.Generate(host, game, 1, _jackpotPlay.Upper, 1 , false, 1);                                                                          
        //                                rng.model.RandomNumberSet[] _secondary= srv.Generate(host, game, 1, _jackpotPlay.Upper, _jackpotPlay.Lower, false, 1);


        //                            }
        //                        }
        //                    }
        //                }
        //            }
        //            #endregion
        //        }
        //        catch   /// -- trap exception handle/re-throw 
        //        { }
        //        finally /// -- clean up  
        //        { }
        //        #endregion

        //        /// -- close connection we are finished
        //        _dbConn.Close( );  
        //    }

        //    /// --
        //    return _response; 
        //}
